class InvalidStudentAgeError(Exception):
    def __init__(self, age, message="学生年龄无效"):
        self.age = age
        self.message = message
        super().__init__(self.message)

    def __str__(self):
        return f"{self.age} {self.message}"


def check_student_age(age):
    try:
        if age <= 0:
            raise InvalidStudentAgeError(age)
        print("学生年龄有效")
    except InvalidStudentAgeError as isae:
        print(f"Error: {isae}")


check_student_age(-5)
check_student_age(0)
check_student_age(5)
